/**
 * 项目名称:
 *
 * @Author: 夏国倩
 * @Date: 2023/10/14 10:29
 * @Copyright
 */
package Reflect;

import java.io.InputStream;
import java.util.Properties;

public class IoPropertiestTest {
    public static void main(String[] args) throws Exception{
        //获取文件的一个绝对路径
        //String path=Thread.currentThread().getContextClassLoader()
               // .getResource("demo/Reflect/classinfo.properties").getPath();
        //FileReader reader=new FileReader(path);
        //直接以流的方式返回
        InputStream reader=Thread.currentThread().getContextClassLoader()
                .getResourceAsStream("demo/Reflect/classinfo.properties");
        Properties pro=new Properties();
        pro.load(reader);
        reader.close();
        //通过key获取value
        String className= pro.getProperty("className");
        System.out.println(className);
    }
}
